package com.tjhk.java.tech.proxy.jdk;

import java.lang.reflect.Proxy;

public class UserTest {
    public static void main(String[] args) {
        UserServiceImpl userService = new UserServiceImpl();
        UserProxyHandler userProxyHandler = new UserProxyHandler(userService);
        UserService userServiceProxy = (UserService) Proxy.newProxyInstance(userService.getClass().getClassLoader(),userService.getClass().getInterfaces(),userProxyHandler);
        userServiceProxy.addUser();
        userServiceProxy.updateUser("我是谁？");
    }
}
